package com.supreme.studyserver.controller;

import com.supreme.commonboot.utils.AjaxResp;
import com.supreme.studyserver.service.SpringEventService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "spring.event")
public class SpringEventController {

    @Resource
    private SpringEventService springEventService;

    @GetMapping(value = "sendMessage")
    public AjaxResp sendMessage(@RequestParam(value = "source") String source, @RequestParam(value = "message") String message) {
        springEventService.sendSimpleEvent(source, message);
        return AjaxResp.instance();
    }
}
